/*
 * Rational.h
 *
 *  Created on: Dec 16, 2011
 *      Author: anna
 */

#ifndef RATIONAL_H_
#define RATIONAL_H_

class Rational {

	int nominator;
	int denominator;

public:
	Rational(int nominator);
	Rational(const Rational& r);
	Rational(int nominator, int denominator);

	Rational& operator =(const Rational& r);
	Rational& operator +=(const Rational& r);
	Rational& operator -=(const Rational& r);
	Rational& operator *=(const Rational& r);
	Rational& operator /=(const Rational& r);
	Rational& operator ++();
	Rational operator ++(int);
	Rational& operator --();
	Rational operator --(int);
	int get_nominator() const;
	int get_denominator() const;

	operator double ();

private:
	void normalize();

};

Rational operator+ (const Rational& a, const Rational& b);
Rational operator- (const Rational& a, const Rational& b);
Rational operator* (const Rational& a, const Rational& b);
Rational operator/ (const Rational& a, const Rational& b);

bool operator== (const Rational& a, const Rational& b);
bool operator!= (const Rational& a, const Rational& b);
bool operator<= (const Rational& a, const Rational& b);
bool operator>= (const Rational& a, const Rational& b);
bool operator<  (const Rational& a, const Rational& b);
bool operator>  (const Rational& a, const Rational& b);

int nod(int a, int b);

#endif /* RATIONAL_H_ */
